<template>
	<view class="news">
		<view class="box">
			<view class="box-nav" v-for="item in news" :key="item.id">
				<image class="imgtx" :src="item.tx"></image>
				<view class="box-title">
					<text>{{item.name}}</text><br>
					<text class="text2">{{item.dt}}</text>
				</view>
				<image class="imgnr" :src="item.sp"></image>
				<view class="box-jj">{{item.nr}}</view>
				<view class="box-dz">
					<text>转发：{{item.zfs}}</text>
					<text>评论：{{item.pl}}</text>
					<text>点赞：{{item.dz}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				news:[]
			}
		},
		onLoad() {
			this.getNews()
		},
		methods: {
			getNews(){
				uni.request({
					url:'http://127.0.0.1:5500/api/shop/news.json',
					success: res => {
						this.news = res.data.message
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #F1F1F1;
		.box {
			.box-nav {
				background: #fff;
				margin-bottom: 15rpx;
				overflow: hidden;
				.imgtx {
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
					margin: 18rpx 0 0 50rpx;
				}

				.box-title {
					display: inline-block;

					text {
						margin: 0 0 0 30rpx;
					}

					text:nth-child(1) {
						color: #ff3366;
						font-weight: 700;
						font-size: 38rpx;
					}

					.text2 {
						color: #808080;
						font-size: 20rpx;
					}
				}
				
				.imgnr {
					width: 73%;
					height: 300rpx;
					margin-top: 20rpx;
					margin-left: 110rpx;
					border-radius: 10rpx;
				}
				
				.box-jj{
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: 30rpx;
					margin-left: 100rpx;
					margin-top: 20rpx;
				}
				
				.box-dz{
					font-size: 30rpx;
					text-align: center;
					margin: 25rpx;
					text{
						padding: 0 45rpx;
					}
				}
			}
		}
	}
</style>
